// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程：https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
const db = uniCloud.database() //代码块为cdb
const admin = db.collection('admin');
module.exports = {
	_before: function () { // 通用预处理器

	},

	async update(id) {
		let time = Math.round(new Date() / 1000);
		let res = await admin.doc(id).update({
			"last_time": time
		})
		return res;
	},
	
	async find(where = {}) {
		let time = Math.round(new Date() / 1000);
		let res = await admin.where(where).get()
		return res.data[0];
	},
}
